package com.eagle.epay.util;

import com.eagle.epay.common.ResultVO;
import com.eagle.epay.constant.ResponseEnum;
import com.eagle.epay.constant.ResultEnum;

/**
 * Created by eagle
 * 2018-11-12 14:02
 */
public class ResultVOUtil {

    public static ResultVO success(Object object) {
        ResultVO resultVO = new ResultVO();
        resultVO.setCode(0);
        resultVO.setMsg(ResponseEnum.SUCCESS.getDesc());
        resultVO.setData(object);
        return resultVO;
    }

    public static ResultVO success() {
        ResultVO resultVO = new ResultVO();
        resultVO.setCode(ResponseEnum.SUCCESS.getCode());
        resultVO.setMsg(ResponseEnum.SUCCESS.getDesc());
        return resultVO;
    }

    public static ResultVO error(ResultEnum resultEnum) {
        ResultVO resultVO = new ResultVO();
        resultVO.setCode(resultEnum.getCode());
        resultVO.setMsg(resultEnum.getMessage());
        return resultVO;
    }
    public static ResultVO error(String errMsg) {
        ResultVO resultVO = new ResultVO();
        resultVO.setCode(ResponseEnum.ERROR.getCode());
        resultVO.setMsg(errMsg);
        return resultVO;
    }
}
